package loon.srpg.effect;

import loon.action.sprite.Animation;
import loon.action.sprite.AnimationStorage;
import loon.core.graphics.opengl.GLEx;
/**
 * Animation类复杂了，但没有继承Sprite
 * @author Administrator
 *
 */
public class SRPGAmEffect extends SRPGEffect {
	private Animation animation;
	private int x,y;
	private int speed,index;
	public SRPGAmEffect(Animation animation,int x,int y,int speed){
		this.animation=animation;
		this.x=x;
		this.y=y;
		this.speed=speed;
		setExist(true);
	}
	@Override
	public void draw(GLEx g, int x, int y) {
		// TODO Auto-generated method stub
		next();
		if(frame%speed==0){
			index++;
		}
		g.drawTexture(animation.getSpriteImage(index), x, y);
	}
	
}
